package open.template.work.udm.client.api;

import com.alibaba.fastjson.JSON;
import open.template.work.commons.vo.udm.resposne.TaskReponseVo;
import open.template.work.udm.client.service.UdmServerService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

@RestController
public class BaseApi {

    private Logger LOGGER= LoggerFactory.getLogger(getClass());

    @Autowired
    UdmServerService udmServerService;


    @RequestMapping("/hello")
    public String health(){
        LOGGER.info("请求任务taskId测试hello");
        return udmServerService.checkServer2();
    }

    @RequestMapping("/task/get")
    public String getTaskInfos(){
        LOGGER.info("请求任务taskId测试");
        TaskReponseVo taskInfo = udmServerService.getTaskInfo(UUID.randomUUID().toString());
        return JSON.toJSONString(taskInfo);
    }
}
